<template>
  <div>
    <h2>App 组件</h2>
    <home></home>
    <suspense>
      <template #default>
        <async-category></async-category>
      </template>
      <template #fallback>
        <loading></loading>
      </template>
    </suspense>
  </div>
</template>

<script>
import { defineAsyncComponent } from "vue";

import Home from "./Home.vue";
import Loading from "./Loading.vue";
// import AsyncCategory from "./AsyncCategory.vue";
const AsyncCategory = defineAsyncComponent(() => import("./AsyncCategory.vue"));
// const AsyncCategory = defineAsyncComponent({
//   loader: () => import("./AsyncCategory.vue"),
//   loadingComponent: Loading,
//   // errorComponent
//   //在显示loadingComponent组件zhiqian ，等待多长时间
//   // delay: 2000,

// /**
//  * err: 错误信息
//  * retry: 函数，调用retry尝试重新加载
//  * fail:  函数，指示加载程序结束退出
//  * attempts: 记录尝试的次数
//  *
//  */
//   onError: function (err, retry,fail, attempts) {},
// });
export default {
  components: {
    Home,
    AsyncCategory,
    Loading,
  },
};
</script>

<style scoped>
</style>